/******************************************************************************
 * 
 * Announce: CSharp Kit, used to achieve data visualization.
 *           Copyright (C) ShenYongchen.
 *           All rights reserved.
 *   Author: 申永辰.郑州 (shenyczz@163.com)
 *  WebSite: http://github.com/shenyczz/CSharpKit
 *
 * THIS CODE IS LICENSED UNDER THE MIT LICENSE (MIT).
 * THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 
 * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
 * IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
 * PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
 * 
******************************************************************************/

using System.Runtime.InteropServices;

namespace CSharpKit.Native.LAPACK
{
    partial class clapack
    {
        //{{@@@

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        /// </remarks>
        [DllImport(_dllname_clapack, CharSet = CharSet.Ansi, EntryPoint = "fn_clapack")]
        public extern static int fn_clapack1();

        /// <summary>
        /// 名称：DGBBRD<br/>
        /// 功能：reduces a real general m-by-n band matrix A to upper bidiagonal
        /// form B by an orthogonal transformation: Q**T * A * P = B.
        /// The routine computes B, and optionally forms Q or P**T, or computes
        /// Q**T*C for a given matrix C.
        /// </summary>
        /// <param name="vect"></param>
        /// <param name="m"></param>
        /// <param name="n"></param>
        /// <param name="ncc"></param>
        /// <param name="kl"></param>
        /// <param name="ku"></param>
        /// <param name="AB"></param>
        /// <param name="ldab"></param>
        /// <param name="d_"></param>
        /// <param name="e"></param>
        /// <param name="Q"></param>
        /// <param name="ldq"></param>
        /// <param name="PT"></param>
        /// <param name="ldpt"></param>
        /// <param name="C_"></param>
        /// <param name="ldc"></param>
        /// <param name="work"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        /// <remarks>
        /// 原型：int dgbbrd_(char* vect, integer* m, integer* n,
        ///     integer* ncc, integer* kl, integer* ku,
        ///     doublereal* ab, integer* ldab,
        ///     doublereal* d__, doublereal* e,
        ///     doublereal* q, integer* ldq,
        ///     doublereal* pt, integer* ldpt,
        ///     doublereal* c__, integer* ldc,
        ///     doublereal* work, integer* info);
        /// </remarks>
        [DllImport(_dllname_clapack, CharSet = CharSet.Ansi, EntryPoint = "dgbbrd_")]
        public extern static int dgbbrd_(
            ref char vect, ref int m, ref int n,
            ref int ncc, ref int kl, ref int ku,
            double[] AB, ref int ldab,
            double[] d_, double[] e,
            double[] Q, ref int ldq,
            double[] PT, ref int ldpt,
            double[] C_, ref int ldc,
            double[] work, ref int info);

        //
        // waiting...
        //




        /// <summary>
        /// 名称：DGELSS <br/>
        /// 功能：computes the minimum norm solution to a real linear least squares problem:(计算实线性最小二乘问题的最小范数解)
        /// </summary>
        /// <param name="m"></param>
        /// <param name="n"></param>
        /// <param name="nrhs"></param>
        /// <param name="A"></param>
        /// <param name="lda"></param>
        /// <param name="B"></param>
        /// <param name="ldb"></param>
        /// <param name="s"></param>
        /// <param name="rcond"></param>
        /// <param name="rank"></param>
        /// <param name="work"></param>
        /// <param name="lwork"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        /// <remarks>
        /// 原型：int dgelss_(integer* m, integer* n, integer* nrhs,
        /// 	doublereal* a, integer* lda, doublereal* b, integer* ldb, doublereal*
        /// 	s, doublereal* rcond, integer* rank, doublereal* work, integer* lwork,
        /// 	integer* info);
        /// </remarks>
        [DllImport(_dllname_clapack, CharSet = CharSet.Ansi, EntryPoint = "dgelss_")]
        public static extern int dgelss_(
            ref int m, ref int n, ref int nrhs,
            double[] A, ref int lda, double[] B, ref int ldb, double[] s,
            ref double rcond, ref int rank, double[] work, ref int lwork, ref int info);

        /// <summary>
        /// 名称：DGELSY <br/>
        /// 功能：solves overdetermined or underdetermined systems for GE matrices(解决GE矩阵的超定或欠定系统)
        /// </summary>
        /// <param name="m"></param>
        /// <param name="n"></param>
        /// <param name="nrhs"></param>
        /// <param name="A"></param>
        /// <param name="lda"></param>
        /// <param name="B"></param>
        /// <param name="ldb"></param>
        /// <param name="jpvt"></param>
        /// <param name="rcond"></param>
        /// <param name="rank"></param>
        /// <param name="work"></param>
        /// <param name="lwork"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        /// <remarks>
        /// int dgelsy_(integer* m, integer* n, integer* nrhs,
        /// 	doublereal* a, integer* lda, doublereal* b, integer* ldb, integer*jpvt, 
        /// 	doublereal* rcond, integer* rank, doublereal* work, integer* lwork, integer* info);
        /// </remarks>
        [DllImport(_dllname_clapack, CharSet = CharSet.Ansi, EntryPoint = "dgelsy_")]
        public static extern int dgelsy_(
            ref int m, ref int n, ref int nrhs,
            double[] A, ref int lda, double[] B, ref int ldb, int[] jpvt,
            ref double rcond, ref int rank, double[] work, ref int lwork, ref int info);



        /// <summary>
        /// 名称：DGEQRF<br/>
        /// 功能：computes a QR factorization of a real M-by-N matrix A:
        ///       A = Q * ( R ),
        ///               ( 0 )
        /// where:
        ///       Q is a M-by-M orthogonal matrix;
        ///       R is an upper-triangular N-by-N matrix;
        ///       0 is a (M-N)-by-N zero matrix, if M > N.
        /// </summary>
        /// <param name="m">The number of rows of the matrix A.  M >= 0.</param>
        /// <param name="n">The number of columns of the matrix A.  N >= 0.</param>
        /// <param name="A">
        /// A is DOUBLE PRECISION array, dimension (LDA,N)
        /// On entry, the M-by-N matrix A.
        /// On exit, the elements on and above the diagonal of the array contain
        /// the min(M,N)-by-N upper trapezoidal matrix R (R isupper triangular if m >= n);
        /// the elements below the diagonal,with the array TAU, represent the orthogonal matrix Q as a
        /// product of min(m,n) elementary reflectors (see Further Details).</param>
        /// <param name="lda">The leading dimension of the array A.  LDA >= max(1,M).</param>
        /// <param name="tau">TAU is DOUBLE PRECISION array, dimension (min(M,N))
        /// The scalar factors of the elementary reflectors </param>
        /// <param name="work">WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
        /// On exit, if INFO = 0, WORK(1) returns the optimal LWORK.</param>
        /// <param name="lwork">The dimension of the array WORK.  LWORK >= max(1,N).</param>
        /// <param name="info">
        /// QE 0:  successful exit
        /// LT 0:  if INFO = -i, the i-th argument had an illegal value</param>
        /// <returns></returns>
        /// <remarks>
        /// int dgerqf_(integer* m, integer* n, doublereal* a, integer* lda,
        ///     doublereal* tau, doublereal* work, integer* lwork, integer* info);
        /// </remarks>
        [DllImport(_dllname_clapack, CharSet = CharSet.Ansi, EntryPoint = "dgerqf_")]
        public static extern int dgeqrf_(
            ref int m, ref int n, double[] A, ref int lda,
            double[] tau, double[] work, ref int lwork, ref int info);


        /// <summary>
        /// 名称：DGESV <br/>
        /// 功能：computes the solution to a real system of linear equations A * X = B,
        /// where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
        /// </summary>
        /// <param name="n">[in] The number of linear equations, i.e., the order
        /// of the matrix A.  N >= 0.</param>
        /// <param name="nrhs">[in] The number of right hand sides, i.e., the number
        /// of columns of the matrix B.  NRHS >= 0.</param>
        /// <param name="A">[in,out]
        /// A is DOUBLE PRECISION array, dimension (LDA,N)
        /// On entry, the N-by-N coefficient matrix A.
        /// On exit, the factors L and U from the factorization A = P*L*U;
        /// the unit diagonal elements of L are not stored.
        /// </param>
        /// <param name="lda">The leading dimension of the array A.  LDA >= max(1,N).</param>
        /// <param name="ipiv">[out]IPIV is INTEGER array, dimension (N)，
        /// The pivot indices that define the permutation matrix P;
        /// row i of the matrix was interchanged with row IPIV(i).</param>
        /// <param name="B">B is DOUBLE PRECISION array, dimension (LDB,NRHS)
        /// On entry, the N-by-NRHS matrix of right hand side matrix B.
        /// On exit, if INFO = 0, the N-by-NRHS solution matrix X.</param>
        /// <param name="ldb">The leading dimension of the array B.  LDB >= max(1,N).</param>
        /// <param name="info">[out]
        /// EQ 0:  successful exit
        /// LT 0:  if INFO = -i, the i-th argument had an illegal value
        /// GT 0:  if INFO = i, U(i,i) is exactly zero.  The factorization
        ///        has been completed, but the factor U is exactly
        ///        singular, so the solution could not be computed.</param>
        /// <returns></returns>
        /// <remarks>
        /// int dgesv_(integer* n, integer* nrhs,
        ///     doublereal* a, integer* lda, integer* ipiv,
        ///     doublereal* b, integer* ldb, integer* info);
        /// </remarks>
        [DllImport(_dllname_clapack, CharSet = CharSet.Ansi, EntryPoint = "dgesv_")]
        public extern static int dgesv_(
            ref int n, ref int nrhs,
            double[] A, ref int lda, double[] ipiv,
            double[] B, ref int ldb, ref int info);


        /// <summary>
        /// 名称：DGESVD <br/>
        /// 功能：computes the singular value decomposition (SVD) of a real M-by-N matrix A,（计算实矩阵的奇异值分解）
        /// optionally computing the left and/or right singular  vectors. The SVD is written
        /// A = U * SIGMA * transpose(V)
        /// </summary>
        /// <param name="jobu"></param>
        /// <param name="jobvt"></param>
        /// <param name="m"></param>
        /// <param name="n"></param>
        /// <param name="A"></param>
        /// <param name="lda"></param>
        /// <param name="s"></param>
        /// <param name="U"></param>
        /// <param name="ldu"></param>
        /// <param name="VT"></param>
        /// <param name="ldvt"></param>
        /// <param name="work"></param>
        /// <param name="lwork"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        /// <remarks>
        /// int dgesvd_(char* jobu, char* jobvt, integer* m, integer* n,
        /// 	doublereal* a, integer* lda, doublereal* s, doublereal* u, integer* ldu
        /// 	doublereal* vt, integer* ldvt, doublereal* work, integer* lwork, integer* info);
        /// </remarks>
        [DllImport(_dllname_clapack, CharSet = CharSet.Ansi, EntryPoint = "dgesvd_")]
        public static extern int dgesvd_(
            ref char jobu, ref char[] jobvt, ref int m, ref int n,
            double[] A, ref int lda, double[] s, double[] U, ref int ldu,
            double[] VT, ref int ldvt, double[] work, ref int lwork, ref int info);


        /// <summary>
        /// 名称：DORGQR <br/>
        /// 功能：generates an M-by-N real matrix Q with orthonormal columns,
        /// which is defined as the first N columns of a product of K elementary
        /// reflectors of order M
        /// Q  =  H(1) H(2) . . . H(k)
        /// </summary>
        /// <param name="m"></param>
        /// <param name="n"></param>
        /// <param name="k"></param>
        /// <param name="a"></param>
        /// <param name="lda"></param>
        /// <param name="tau"></param>
        /// <param name="work"></param>
        /// <param name="lwork"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        [DllImport(_dllname_clapack, CharSet = CharSet.Ansi, EntryPoint = "dorgqr_")]
        public static extern int dorgqr_(
            ref int m, ref int n, ref int k, double[] a, ref int lda,
            double[] tau, double[] work, ref int lwork, ref int info);
        /// int dorgqr_(integer* m, integer* n, integer* k, doublereal* a, integer* lda,
        ///     doublereal* tau, doublereal* work, integer* lwork, integer* info);



        /// <remarks>
        /// </remarks>


        /*


        */



        //}}@@@
    }

}
